package com.naiterui.ehp.bs.doctor.vo.medicine;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.naiterui.ehp.bp.utils.lang.ConfigUtil;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(value = "MedicineCustomDataUnitVO", description = "自定义用量日期单位对应值")
public class MedicineCustomDataUnitVO implements Serializable {

    /**
     * 字段或域定义：<code>serialVersionUID</code>
     */
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "日期单位:小时、日、隔日等等")
    private String customDateUnit;

    @ApiModelProperty(value = "分子")
    private Integer customMolecule;

    @ApiModelProperty(value = "分母")
    private Integer customDenominator;

    public String getCustomDateUnit() {
        return this.customDateUnit;
    }

    public void setCustomDateUnit(String customDateUnit) {
        this.customDateUnit = customDateUnit;
    }

    public Integer getCustomMolecule() {
        return this.customMolecule;
    }

    public void setCustomMolecule(Integer customMolecule) {
        this.customMolecule = customMolecule;
    }

    public Integer getCustomDenominator() {
        return this.customDenominator;
    }

    public void setCustomDenominator(Integer customDenominator) {
        this.customDenominator = customDenominator;
    }

    public static List<MedicineCustomDataUnitVO> toVOList() {
        List<MedicineCustomDataUnitVO> list = new ArrayList<>();
        String dataUnitList = ConfigUtil.getString("init.medicine.custom.dataUnitList");
        String[] strArray = dataUnitList.split(",");
        for (String aStrArray : strArray) {
            String[] str = aStrArray.split("-");
            MedicineCustomDataUnitVO vo = new MedicineCustomDataUnitVO();
            vo.setCustomDateUnit(str[0]);
            vo.setCustomMolecule(Integer.parseInt(str[1]));
            vo.setCustomDenominator(Integer.parseInt(str[2]));
            list.add(vo);
        }
        return list;
    }
}
